package com.zhihaoliang.room.data

import androidx.room.*

/**
 * @author 支豪亮
 * @date 2023/1/30 14:42
 * @des 支持全文搜索
 */
@Entity(tableName = "users")
data class User(
    @PrimaryKey val rowid: Int,
    @ColumnInfo(name = "last_name") val lastName: String?,
    @ColumnInfo(name = "first_name") val firstName: String?,
)

@Dao
interface UserDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertAll(users: List<User>)

    @Query("SELECT * FROM users WHERE last_name LIKE '%1%'")
    suspend fun queryLikeUsers() :List<User>
}